<?php

require_once(sfConfig::get('sf_lib_dir').'/filter/base/BaseFormFilterPropel.class.php');

/**
 * GestdentReserva2 filter form base class.
 *
 * @package    gestdent
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfPropelFormFilterGeneratedTemplate.php 16976 2009-04-04 12:47:44Z fabien $
 */
class BaseGestdentReserva2FormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'fecha'          => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'personal'       => new sfWidgetFormPropelChoice(array('model' => 'GestdentPersonal', 'add_empty' => true)),
      'hora'           => new sfWidgetFormPropelChoice(array('model' => 'GestdentHora', 'add_empty' => true)),
      'sucursal'       => new sfWidgetFormPropelChoice(array('model' => 'GestdentSucursal', 'add_empty' => true)),
      'paciente'       => new sfWidgetFormPropelChoice(array('model' => 'GestdentPaciente', 'add_empty' => true)),
      'tipoasistencia' => new sfWidgetFormPropelChoice(array('model' => 'GestdentTipoasistencia', 'add_empty' => true)),
      'confirmado'     => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'recepcionado'   => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'observacion'    => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'fecha'          => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'personal'       => new sfValidatorPropelChoice(array('required' => false, 'model' => 'GestdentPersonal', 'column' => 'id')),
      'hora'           => new sfValidatorPropelChoice(array('required' => false, 'model' => 'GestdentHora', 'column' => 'id')),
      'sucursal'       => new sfValidatorPropelChoice(array('required' => false, 'model' => 'GestdentSucursal', 'column' => 'id')),
      'paciente'       => new sfValidatorPropelChoice(array('required' => false, 'model' => 'GestdentPaciente', 'column' => 'id')),
      'tipoasistencia' => new sfValidatorPropelChoice(array('required' => false, 'model' => 'GestdentTipoasistencia', 'column' => 'id')),
      'confirmado'     => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'recepcionado'   => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'observacion'    => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('gestdent_reserva2_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'GestdentReserva2';
  }

  public function getFields()
  {
    return array(
      'id'             => 'Number',
      'fecha'          => 'Date',
      'personal'       => 'ForeignKey',
      'hora'           => 'ForeignKey',
      'sucursal'       => 'ForeignKey',
      'paciente'       => 'ForeignKey',
      'tipoasistencia' => 'ForeignKey',
      'confirmado'     => 'Boolean',
      'recepcionado'   => 'Boolean',
      'observacion'    => 'Text',
    );
  }
}
